
*	************************************************************************
* 	File-Name: 		Prep.do
*	Date:  			8 February 2013
*	Last Edited:  	8 February 2013
*	Data Used:  	SlumsIndia.dta ("22626-0002-Data.dta")
*	Purpose:   		.do file for data coding
*	Software:		Stata IC 12.1
*	Machine:		WINDOWS 7 (HSP), MacBook Pro (MA)
*	Content:		0. Open the data
*					1. Running ICPSR's own recoding scheme (missing data)
*					2. Dependent variable
*					3. Independent variable
*					4. Control variable
*					5. Other
*	************************************************************************

clear all
capture log close


*	************************************************************************
*	0. Calling up the data
*	************************************************************************


use "./SlumsIndia.dta"
set more off, permanently




*	************************************************************************
*	1. Recoding the data
*		Using ICPSR's own recoding scheme which replaces missing by
*		Stata missing obersvations (".").
*	************************************************************************

 /*-------------------------------------------------------------------------*
 |                                                                         
 |            STATA SUPPLEMENTAL SYNTAX FILE FOR ICPSR 22626
 |              INDIA HUMAN DEVELOPMENT SURVEY (IHDS), 2005
 |                       (DATASET 0002: HOUSEHOLD)
 |
 |
 | This Stata missing value recode program is provided for optional use with
 | the Stata system version of this data file as distributed by ICPSR.
 | The program replaces user-defined numeric missing values (e.g., -9)
 | with generic system missing "."  Note that Stata allows you to specify
 | up to 27 unique missing value codes.  Only variables with user-defined
 | missing values are included in this program.
 |
 | To apply the missing value recodes, users need to first open the
 | Stata data file on their system, apply the missing value recodes if
 | desired, then save a new copy of the data file with the missing values
 | applied.  Users are strongly advised to use a different filename when
 | saving the new file.
 |
 *------------------------------------------------------------------------*/

replace DISTID = . if (DISTID >= -7 & DISTID <= -1)
replace PSUID = . if (PSUID >= -7 & PSUID <= -1)
replace HHID = . if (HHID >= -7 & HHID <= -1)
replace HHSPLITID = . if (HHSPLITID >= -7 & HHSPLITID <= -1)
replace COPC = . if (COPC >= -7 & COPC <= -1)
replace HHED5ADULT = . if (HHED5ADULT >= -7 & HHED5ADULT <= -1)
replace HHED5F = . if (HHED5F >= -7 & HHED5F <= -1)
replace HHED5M = . if (HHED5M >= -7 & HHED5M <= -1)
replace POOR = . if (POOR >= -6 & POOR <= -4)
replace HC3 = . if (HC3 >= -7 & HC3 <= -1)
replace HC6 = . if (HC6 >= -7 & HC6 <= -1)
replace HC9 = . if (HC9 >= -7 & HC9 <= -1)
replace HC10 = . if (HC10 >= -7 & HC10 <= -1)
replace HC12 = . if (HC12 >= -7 & HC12 <= -1)
replace HC14 = . if (HC14 >= -7 & HC14 <= -1)
replace HC15 = . if (HC15 >= -7 & HC15 <= -1)
replace HS1 = . if (HS1 >= -7 & HS1 <= -1)
replace HS3 = . if (HS3 >= -7 & HS3 <= -1)
replace HS3B = . if (HS3B >= -7 & HS3B <= -1)
replace ID1 = . if (ID1 >= -7 & ID1 <= -1)
replace ID2 = . if (ID2 >= -7 & ID2 <= -1)
replace ID4 = . if (ID4 >= -7 & ID4 <= -1)
replace ID5 = . if (ID5 >= -7 & ID5 <= -1)
replace ID6 = . if (ID6 >= -7 & ID6 <= -1)
replace ID7A = . if (ID7A >= -7 & ID7A <= -1)
replace ID8A = . if (ID8A >= -7 & ID8A <= -1)
replace ID16 = . if (ID16 >= -7 & ID16 <= -1)
replace ID17 = . if (ID17 >= -7 & ID17 <= -1)
replace ID18 = . if (ID18 >= -7 & ID18 <= -1)
replace ID19 = . if (ID19 >= -7 & ID19 <= -1)
replace ID20 = . if (ID20 >= -7 & ID20 <= -1)
replace FM2 = . if (FM2 >= -7.00 & FM2 <= -1.00)
replace FM3 = . if (FM3 >= -7 & FM3 <= -1)
replace FM4 = . if (FM4 >= -7.00 & FM4 <= -1.00)
replace FM5 = . if (FM5 >= -7.00 & FM5 <= -1.00)
replace FM6A = . if (FM6A >= -7.00 & FM6A <= -1.00)
replace FM6B = . if (FM6B >= -7 & FM6B <= -1)
replace FM6C = . if (FM6C >= -7 & FM6C <= -1)
replace FM6D = . if (FM6D >= -7 & FM6D <= -1)
replace FM6E = . if (FM6E >= -7 & FM6E <= -1)
replace FM7 = . if (FM7 >= -7.00 & FM7 <= -1.00)
replace FM8A = . if (FM8A >= -7.00 & FM8A <= -1.00)
replace FM8B = . if (FM8B >= -7 & FM8B <= -1)
replace FM8C = . if (FM8C >= -7 & FM8C <= -1)
replace FM9A = . if (FM9A >= -7 & FM9A <= -1)
replace FM9B = . if (FM9B >= -7 & FM9B <= -1)
replace FM9C = . if (FM9C >= -7 & FM9C <= -1)
replace FM9D = . if (FM9D >= -7.00 & FM9D <= -1.00)
replace FM19A = . if (FM19A >= -7 & FM19A <= -1)
replace FM19B = . if (FM19B >= -7 & FM19B <= -1)
replace FM20A = . if (FM20A >= -7 & FM20A <= -1)
replace FM20B = . if (FM20B >= -7 & FM20B <= -1)
replace FM20C = . if (FM20C >= -7 & FM20C <= -1)
replace FM21A = . if (FM21A >= -7 & FM21A <= -1)
replace FM21B = . if (FM21B >= -7 & FM21B <= -1)
replace FM22 = . if (FM22 >= -7 & FM22 <= -1)
replace FM23 = . if (FM23 >= -7 & FM23 <= -1)
replace FM24 = . if (FM24 >= -7 & FM24 <= -1)
replace FM25 = . if (FM25 >= -7 & FM25 <= -1)
replace FM26 = . if (FM26 >= -7 & FM26 <= -1)
replace FM27 = . if (FM27 >= -7 & FM27 <= -1)
replace FMTOTAL = . if (FMTOTAL >= -7 & FMTOTAL <= -1)
replace FM31 = . if (FM31 >= -7 & FM31 <= -1)
replace FM32A = . if (FM32A >= -7 & FM32A <= -1)
replace FM32B = . if (FM32B >= -7 & FM32B <= -1)
replace FM32C = . if (FM32C >= -7 & FM32C <= -1)
replace FM32D = . if (FM32D >= -7 & FM32D <= -1)
replace FM32E = . if (FM32E >= -7 & FM32E <= -1)
replace FM32F = . if (FM32F >= -7 & FM32F <= -1)
replace FM32G = . if (FM32G >= -7 & FM32G <= -1)
replace FM32H = . if (FM32H >= -7 & FM32H <= -1)
replace FM32I = . if (FM32I >= -7 & FM32I <= -1)
replace AN1A = . if (AN1A >= -7 & AN1A <= -1)
replace AN1B = . if (AN1B >= -7 & AN1B <= -1)
replace AN1C = . if (AN1C >= -7 & AN1C <= -1)
replace AN1D = . if (AN1D >= -7 & AN1D <= -1)
replace AN1E = . if (AN1E >= -7 & AN1E <= -1)
replace AN1F = . if (AN1F >= -7 & AN1F <= -1)
replace AN1G = . if (AN1G >= -7 & AN1G <= -1)
replace AN2A = . if (AN2A >= -7 & AN2A <= -1)
replace AN2B = . if (AN2B >= -7 & AN2B <= -1)
replace AN3 = . if (AN3 >= -7 & AN3 <= -1)
replace AN4A = . if (AN4A >= -7 & AN4A <= -1)
replace AN4B = . if (AN4B >= -7 & AN4B <= -1)
replace AN4C = . if (AN4C >= -7 & AN4C <= -1)
replace AN7 = . if (AN7 >= -7 & AN7 <= -1)
replace NF1A = . if (NF1A >= -7 & NF1A <= -1)
replace NF1B = . if (NF1B >= -7 & NF1B <= -1)
replace NF2 = . if (NF2 >= -7 & NF2 <= -1)
replace NF3 = . if (NF3 >= -7 & NF3 <= -1)
replace NF4 = . if (NF4 >= -7 & NF4 <= -1)
replace NF5 = . if (NF5 >= -7 & NF5 <= -1)
replace NF6 = . if (NF6 >= -7 & NF6 <= -1)
replace NF10A = . if (NF10A >= -7 & NF10A <= -1)
replace NF10B = . if (NF10B >= -7 & NF10B <= -1)
replace NF11 = . if (NF11 >= -7 & NF11 <= -1)
replace NF12 = . if (NF12 >= -7 & NF12 <= -1)
replace NF13 = . if (NF13 >= -7 & NF13 <= -1)
replace NF14 = . if (NF14 >= -7 & NF14 <= -1)
replace NF15 = . if (NF15 >= -7 & NF15 <= -1)
replace NF19A = . if (NF19A >= -7 & NF19A <= -1)
replace NF19B = . if (NF19B >= -7 & NF19B <= -1)
replace NF20 = . if (NF20 >= -7 & NF20 <= -1)
replace NF21 = . if (NF21 >= -7 & NF21 <= -1)
replace NF22 = . if (NF22 >= -7 & NF22 <= -1)
replace NF23 = . if (NF23 >= -7 & NF23 <= -1)
replace NF24 = . if (NF24 >= -7 & NF24 <= -1)
replace IN1 = . if (IN1 >= -7 & IN1 <= -1)
replace IN2 = . if (IN2 >= -7 & IN2 <= -1)
replace IN3A = . if (IN3A >= -7 & IN3A <= -1)
replace IN3B = . if (IN3B >= -7 & IN3B <= -1)
replace IN4A = . if (IN4A >= -7 & IN4A <= -1)
replace IN4B = . if (IN4B >= -7 & IN4B <= -1)
replace IN5 = . if (IN5 >= -7 & IN5 <= -1)
replace IN6 = . if (IN6 >= -7 & IN6 <= -1)
replace IN14A = . if (IN14A >= -7 & IN14A <= -1)
replace IN14B = . if (IN14B >= -7 & IN14B <= -1)
replace IN15 = . if (IN15 >= -7 & IN15 <= -1)
replace IN15A = . if (IN15A >= -7 & IN15A <= -1)
replace IN15B = . if (IN15B >= -7 & IN15B <= -1)
replace IN15C = . if (IN15C >= -7 & IN15C <= -1)
replace IN15D = . if (IN15D >= -7 & IN15D <= -1)
replace IN15E = . if (IN15E >= -7 & IN15E <= -1)
replace IN16 = . if (IN16 >= -7 & IN16 <= -1)
replace IN17 = . if (IN17 >= -7 & IN17 <= -1)
replace RC1 = . if (RC1 >= -7 & RC1 <= -1)
replace RC1A = . if (RC1A >= -7 & RC1A <= -1)
replace RC1B = . if (RC1B >= -7 & RC1B <= -1)
replace RC1C = . if (RC1C >= -7 & RC1C <= -1)
replace RC1D = . if (RC1D >= -7 & RC1D <= -1)
replace RC2 = . if (RC2 >= -7 & RC2 <= -1)
replace RC3 = . if (RC3 >= -7 & RC3 <= -1)
replace RC4 = . if (RC4 >= -7 & RC4 <= -1)
replace RC5 = . if (RC5 >= -7 & RC5 <= -1)
replace MM1A = . if (MM1A >= -7 & MM1A <= -1)
replace MM2A = . if (MM2A >= -7 & MM2A <= -1)
replace MM3A = . if (MM3A >= -7 & MM3A <= -1)
replace MM4A = . if (MM4A >= -7 & MM4A <= -1)
replace MM5A = . if (MM5A >= -7 & MM5A <= -1)
replace MM1B = . if (MM1B >= -7 & MM1B <= -1)
replace MM2B = . if (MM2B >= -7 & MM2B <= -1)
replace MM3B = . if (MM3B >= -7 & MM3B <= -1)
replace MM4B = . if (MM4B >= -7 & MM4B <= -1)
replace MM5B = . if (MM5B >= -7 & MM5B <= -1)
replace MM1C = . if (MM1C >= -7 & MM1C <= -1)
replace MM2C = . if (MM2C >= -7 & MM2C <= -1)
replace MM3C = . if (MM3C >= -7 & MM3C <= -1)
replace MM4C = . if (MM4C >= -7 & MM4C <= -1)
replace MM5C = . if (MM5C >= -7 & MM5C <= -1)
replace CO1X = . if (CO1X >= -7 & CO1X <= -1)
replace CO1A = . if (CO1A >= -7 & CO1A <= -1)
replace CO1B = . if (CO1B == -1)
replace CO1C = . if (CO1C >= -7 & CO1C <= -1)
replace CO1D = . if (CO1D >= -7 & CO1D <= -1)
replace CO1E = . if (CO1E >= -7 & CO1E <= -1)
replace CO2X = . if (CO2X >= -7 & CO2X <= -1)
replace CO2A = . if (CO2A >= -7 & CO2A <= -1)
replace CO2B = . if (CO2B == -1)
replace CO2C = . if (CO2C >= -7 & CO2C <= -1)
replace CO2D = . if (CO2D >= -7 & CO2D <= -1)
replace CO2E = . if (CO2E >= -7 & CO2E <= -1)
replace CO3X = . if (CO3X >= -7 & CO3X <= -1)
replace CO3A = . if (CO3A >= -7 & CO3A <= -1)
replace CO3B = . if (CO3B == -1)
replace CO3C = . if (CO3C >= -7 & CO3C <= -1)
replace CO3D = . if (CO3D >= -7 & CO3D <= -1)
replace CO3E = . if (CO3E >= -7.00 & CO3E <= -1.00)
replace CO4X = . if (CO4X >= -7 & CO4X <= -1)
replace CO4A = . if (CO4A >= -7 & CO4A <= -1)
replace CO4B = . if (CO4B == -1)
replace CO4C = . if (CO4C >= -7.00 & CO4C <= -1.00)
replace CO4D = . if (CO4D >= -7 & CO4D <= -1)
replace CO4E = . if (CO4E >= -7 & CO4E <= -1)
replace CO5X = . if (CO5X >= -7 & CO5X <= -1)
replace CO5A = . if (CO5A >= -7 & CO5A <= -1)
replace CO5B = . if (CO5B == -1)
replace CO5C = . if (CO5C >= -7.00 & CO5C <= -1.00)
replace CO5D = . if (CO5D >= -7 & CO5D <= -1)
replace CO5E = . if (CO5E >= -7 & CO5E <= -1)
replace CO6X = . if (CO6X >= -7 & CO6X <= -1)
replace CO6A = . if (CO6A >= -7 & CO6A <= -1)
replace CO6B = . if (CO6B == -1)
replace CO6C = . if (CO6C >= -7.00 & CO6C <= -1.00)
replace CO6T = . if (CO6T >= -7 & CO6T <= -1)
replace CO7X = . if (CO7X >= -7 & CO7X <= -1)
replace CO7A = . if (CO7A >= -7 & CO7A <= -1)
replace CO7B = . if (CO7B == -1)
replace CO7C = . if (CO7C >= -7.00 & CO7C <= -1.00)
replace CO7T = . if (CO7T >= -7 & CO7T <= -1)
replace CO8X = . if (CO8X >= -7 & CO8X <= -1)
replace CO8A = . if (CO8A >= -7 & CO8A <= -1)
replace CO8B = . if (CO8B == -1)
replace CO8C = . if (CO8C >= -7.00 & CO8C <= -1.00)
replace CO8T = . if (CO8T >= -7 & CO8T <= -1)
replace CO9X = . if (CO9X >= -7 & CO9X <= -1)
replace CO9A = . if (CO9A >= -7 & CO9A <= -1)
replace CO9B = . if (CO9B == -1)
replace CO9C = . if (CO9C >= -7.00 & CO9C <= -1.00)
replace CO9T = . if (CO9T >= -7 & CO9T <= -1)
replace CO10X = . if (CO10X >= -7 & CO10X <= -1)
replace CO10A = . if (CO10A >= -7 & CO10A <= -1)
replace CO10B = . if (CO10B == -1)
replace CO10C = . if (CO10C >= -7.00 & CO10C <= -1.00)
replace CO10T = . if (CO10T >= -7 & CO10T <= -1)
replace CO11X = . if (CO11X >= -7 & CO11X <= -1)
replace CO11A = . if (CO11A >= -7 & CO11A <= -1)
replace CO11B = . if (CO11B >= -7 & CO11B <= -1)
replace CO11C = . if (CO11C >= -7.00 & CO11C <= -1.00)
replace CO11T = . if (CO11T >= -7 & CO11T <= -1)
replace CO12X = . if (CO12X >= -7 & CO12X <= -1)
replace CO12A = . if (CO12A >= -7 & CO12A <= -1)
replace CO12B = . if (CO12B >= -7 & CO12B <= -1)
replace CO12C = . if (CO12C >= -7.00 & CO12C <= -1.00)
replace CO12T = . if (CO12T >= -7 & CO12T <= -1)
replace CO13X = . if (CO13X >= -7 & CO13X <= -1)
replace CO13A = . if (CO13A >= -7 & CO13A <= -1)
replace CO13B = . if (CO13B >= -7 & CO13B <= -1)
replace CO13C = . if (CO13C >= -7.00 & CO13C <= -1.00)
replace CO13T = . if (CO13T >= -7 & CO13T <= -1)
replace CO14X = . if (CO14X >= -7 & CO14X <= -1)
replace CO14A = . if (CO14A >= -7 & CO14A <= -1)
replace CO14B = . if (CO14B >= -7 & CO14B <= -1)
replace CO14C = . if (CO14C >= -7.00 & CO14C <= -1.00)
replace CO14T = . if (CO14T >= -7 & CO14T <= -1)
replace CO15 = . if (CO15 >= -7 & CO15 <= -1)
replace CO16 = . if (CO16 >= -7 & CO16 <= -1)
replace CO17 = . if (CO17 >= -7 & CO17 <= -1)
replace CO18 = . if (CO18 >= -7 & CO18 <= -1)
replace CO19 = . if (CO19 >= -7 & CO19 <= -1)
replace CO20 = . if (CO20 >= -7 & CO20 <= -1)
replace CO21 = . if (CO21 >= -7 & CO21 <= -1)
replace CO22 = . if (CO22 >= -7 & CO22 <= -1)
replace CO23 = . if (CO23 >= -7 & CO23 <= -1)
replace CO24 = . if (CO24 >= -7 & CO24 <= -1)
replace CO25 = . if (CO25 >= -7 & CO25 <= -1)
replace CO26 = . if (CO26 >= -7 & CO26 <= -1)
replace CO27 = . if (CO27 >= -7 & CO27 <= -1)
replace CO28 = . if (CO28 >= -7 & CO28 <= -1)
replace CO29 = . if (CO29 >= -7 & CO29 <= -1)
replace CO30 = . if (CO30 >= -7 & CO30 <= -1)
replace CO31 = . if (CO31 >= -7 & CO31 <= -1)
replace CO32 = . if (CO32 >= -7 & CO32 <= -1)
replace CO33 = . if (CO33 >= -7 & CO33 <= -1)
replace CO34 = . if (CO34 >= -7 & CO34 <= -1)
replace CO35 = . if (CO35 >= -7 & CO35 <= -1)
replace CO36 = . if (CO36 >= -7 & CO36 <= -1)
replace CO37 = . if (CO37 >= -7 & CO37 <= -1)
replace CO38 = . if (CO38 >= -7 & CO38 <= -1)
replace CO39 = . if (CO39 >= -7 & CO39 <= -1)
replace CO40 = . if (CO40 >= -7 & CO40 <= -1)
replace CO41 = . if (CO41 >= -7 & CO41 <= -1)
replace CO42 = . if (CO42 >= -7 & CO42 <= -1)
replace CO43 = . if (CO43 >= -7 & CO43 <= -1)
replace CO44 = . if (CO44 >= -7 & CO44 <= -1)
replace CO45 = . if (CO45 >= -7 & CO45 <= -1)
replace CO46 = . if (CO46 >= -7 & CO46 <= -1)
replace CO47 = . if (CO47 >= -7 & CO47 <= -1)
replace CG1 = . if (CG1 >= -7 & CG1 <= -1)
replace CG2 = . if (CG2 >= -7 & CG2 <= -1)
replace CG3 = . if (CG3 >= -7 & CG3 <= -1)
replace CG4 = . if (CG4 >= -7 & CG4 <= -1)
replace CG5 = . if (CG5 >= -7 & CG5 <= -1)
replace CG6 = . if (CG6 >= -7 & CG6 <= -1)
replace CG7 = . if (CG7 >= -7 & CG7 <= -1)
replace CG8 = . if (CG8 >= -7 & CG8 <= -1)
replace CG9 = . if (CG9 >= -7 & CG9 <= -1)
replace CG10 = . if (CG10 >= -7 & CG10 <= -1)
replace CG11 = . if (CG11 >= -7 & CG11 <= -1)
replace CG12 = . if (CG12 >= -7 & CG12 <= -1)
replace CG13 = . if (CG13 >= -7 & CG13 <= -1)
replace CG14 = . if (CG14 >= -7 & CG14 <= -1)
replace CG15 = . if (CG15 >= -7 & CG15 <= -1)
replace CG16 = . if (CG16 >= -7 & CG16 <= -1)
replace CG17 = . if (CG17 >= -7 & CG17 <= -1)
replace CG18 = . if (CG18 >= -7 & CG18 <= -1)
replace CG19 = . if (CG19 >= -7 & CG19 <= -1)
replace CG20 = . if (CG20 >= -7 & CG20 <= -1)
replace CG21 = . if (CG21 >= -7 & CG21 <= -1)
replace CG22 = . if (CG22 >= -7 & CG22 <= -1)
replace CG23 = . if (CG23 >= -7 & CG23 <= -1)
replace CG24 = . if (CG24 >= -7 & CG24 <= -1)
replace DB1 = . if (DB1 >= -7 & DB1 <= -1)
replace DB2 = . if (DB2 >= -7 & DB2 <= -1)
replace DB2B = . if (DB2B >= -7 & DB2B <= -1)
replace DB2C = . if (DB2C >= -7 & DB2C <= -1)
replace DB2D = . if (DB2D >= -7 & DB2D <= -1)
replace DB2E = . if (DB2E >= -7.00 & DB2E <= -1.00)
replace DB2F = . if (DB2F >= -7 & DB2F <= -1)
replace DB3A = . if (DB3A >= -7 & DB3A <= -1)
replace DB3B = . if (DB3B >= -7 & DB3B <= -1)
replace DB4 = . if (DB4 >= -7 & DB4 <= -1)
replace DB5A = . if (DB5A >= -7 & DB5A <= -1)
replace DB5B = . if (DB5B >= -7 & DB5B <= -1)
replace DB6 = . if (DB6 >= -7 & DB6 <= -1)
replace SN1A = . if (SN1A >= -7 & SN1A <= -1)
replace SN1B = . if (SN1B >= -7 & SN1B <= -1)
replace SN1C = . if (SN1C >= -7 & SN1C <= -1)
replace SN1D = . if (SN1D >= -7 & SN1D <= -1)
replace SN1E = . if (SN1E >= -7 & SN1E <= -1)
replace SN1F = . if (SN1F >= -7 & SN1F <= -1)
replace SN2A = . if (SN2A >= -7 & SN2A <= -1)
replace SN2B = . if (SN2B >= -7 & SN2B <= -1)
replace SN2C = . if (SN2C >= -7 & SN2C <= -1)
replace SN2D = . if (SN2D >= -7 & SN2D <= -1)
replace SN2E = . if (SN2E >= -7 & SN2E <= -1)
replace SN2F = . if (SN2F >= -7 & SN2F <= -1)
replace SN3A = . if (SN3A >= -7 & SN3A <= -1)
replace SN3B = . if (SN3B >= -7 & SN3B <= -1)
replace SN3C = . if (SN3C >= -7 & SN3C <= -1)
replace SN3D = . if (SN3D >= -7 & SN3D <= -1)
replace SN3E = . if (SN3E >= -7 & SN3E <= -1)
replace SN3F = . if (SN3F >= -7 & SN3F <= -1)
replace ME1 = . if (ME1 >= -7 & ME1 <= -1)
replace ME2 = . if (ME2 >= -7 & ME2 <= -1)
replace ME3 = . if (ME3 >= -7 & ME3 <= -1)
replace ME4 = . if (ME4 >= -7 & ME4 <= -1)
replace ME5 = . if (ME5 >= -7 & ME5 <= -1)
replace ME6 = . if (ME6 >= -7 & ME6 <= -1)
replace ME7 = . if (ME7 >= -7 & ME7 <= -1)
replace ME8 = . if (ME8 >= -7 & ME8 <= -1)
replace ME9 = . if (ME9 >= -7 & ME9 <= -1)
replace ME10 = . if (ME10 >= -7 & ME10 <= -1)
replace ME11 = . if (ME11 >= -7 & ME11 <= -1)
replace ME12 = . if (ME12 >= -7 & ME12 <= -1)
replace TR1 = . if (TR1 >= -7 & TR1 <= -1)
replace TR2 = . if (TR2 >= -7 & TR2 <= -1)
replace TR3 = . if (TR3 >= -7 & TR3 <= -1)
replace LC1 = . if (LC1 >= -7 & LC1 <= -1)
replace LC2 = . if (LC2 >= -7 & LC2 <= -1)
replace LC3 = . if (LC3 >= -7 & LC3 <= -1)
replace LC4 = . if (LC4 >= -7 & LC4 <= -1)
replace CI1 = . if (CI1 >= -7 & CI1 <= -1)
replace CI2 = . if (CI2 >= -7 & CI2 <= -1)
replace CI3 = . if (CI3 >= -7 & CI3 <= -1)
replace CI4 = . if (CI4 >= -7 & CI4 <= -1)
replace CI5 = . if (CI5 >= -7 & CI5 <= -1)
replace CI6 = . if (CI6 >= -7 & CI6 <= -1)
replace CI7 = . if (CI7 >= -7 & CI7 <= -1)
replace CI8 = . if (CI8 >= -7 & CI8 <= -1)
replace CI9 = . if (CI9 >= -7 & CI9 <= -1)
replace CI10 = . if (CI10 >= -7 & CI10 <= -1)
replace DE1 = . if (DE1 >= -7 & DE1 <= -1)
replace DE2A = . if (DE2A >= -7 & DE2A <= -1)
replace DE3A = . if (DE3A >= -7 & DE3A <= -1)
replace DE4A = . if (DE4A >= -7 & DE4A <= -1)
replace DE5A = . if (DE5A >= -7 & DE5A <= -1)
replace DE6A = . if (DE6A >= -7 & DE6A <= -1)
replace DE2B = . if (DE2B >= -7 & DE2B <= -1)
replace DE3B = . if (DE3B >= -7 & DE3B <= -1)
replace DE4B = . if (DE4B >= -7 & DE4B <= -1)
replace DE5B = . if (DE5B >= -7 & DE5B <= -1)
replace DE6B = . if (DE6B >= -7 & DE6B <= -1)
replace DE2C = . if (DE2C >= -7 & DE2C <= -1)
replace DE3C = . if (DE3C >= -7 & DE3C <= -1)
replace DE4C = . if (DE4C >= -7 & DE4C <= -1)
replace DE5C = . if (DE5C >= -7 & DE5C <= -1)
replace DE6C = . if (DE6C >= -7 & DE6C <= -1)
replace OH1A = . if (OH1A >= -7 & OH1A <= -1)
replace OH2A = . if (OH2A >= -7 & OH2A <= -1)
replace OH2B = . if (OH2B >= -7 & OH2B <= -1)
replace OH2C = . if (OH2C >= -7 & OH2C <= -1)
replace OH2D = . if (OH2D >= -7 & OH2D <= -1)
replace OH3 = . if (OH3 >= -7 & OH3 <= -1)
replace OH4 = . if (OH4 >= -7 & OH4 <= -1)
replace OH5 = . if (OH5 >= -7 & OH5 <= -1)
replace OH6 = . if (OH6 >= -7 & OH6 <= -1)
replace OH7 = . if (OH7 >= -7 & OH7 <= -1)
replace OH8 = . if (OH8 >= -7 & OH8 <= -1)
replace OH9 = . if (OH9 >= -7 & OH9 <= -1)
replace OH9B = . if (OH9B >= -7 & OH9B <= -1)
replace GE1 = . if (GE1 >= -7 & GE1 <= -1)
replace GE3 = . if (GE3 >= -7 & GE3 <= -1)
replace GE6 = . if (GE6 >= -7 & GE6 <= -1)
replace GE9 = . if (GE9 >= -7 & GE9 <= -1)
replace GE10A = . if (GE10A >= -7 & GE10A <= -1)
replace GE10B = . if (GE10B >= -7 & GE10B <= -1)
replace GE11 = . if (GE11 >= -7 & GE11 <= -1)
replace GE12 = . if (GE12 >= -7 & GE12 <= -1)
replace GE13 = . if (GE13 >= -7 & GE13 <= -1)
replace GE14 = . if (GE14 >= -7 & GE14 <= -1)
replace CD1 = . if (CD1 >= -7 & CD1 <= -1)
replace CD3 = . if (CD3 >= -7 & CD3 <= -1)
replace CD3B = . if (CD3B >= -7 & CD3B <= -1)
replace HI1 = . if (HI1 >= -7 & HI1 <= -1)
replace HI2 = . if (HI2 >= -7 & HI2 <= -1)
replace HI3 = . if (HI3 >= -7 & HI3 <= -1)
replace HI4 = . if (HI4 >= -7 & HI4 <= -1)
replace HI5 = . if (HI5 >= -7 & HI5 <= -1)
replace HI6 = . if (HI6 >= -7 & HI6 <= -1)
replace HI7A = . if (HI7A >= -7 & HI7A <= -1)
replace HI8A = . if (HI8A >= -7 & HI8A <= -1)
replace HI9 = . if (HI9 >= -7 & HI9 <= -1)
replace HI10 = . if (HI10 >= -7 & HI10 <= -1)
replace HI12 = . if (HI12 >= -7 & HI12 <= -1)
replace CH1 = . if (CH1 >= -7 & CH1 <= -1)
replace CH2 = . if (CH2 >= -7 & CH2 <= -1)
replace CH3 = . if (CH3 >= -7 & CH3 <= -1)
replace CH4 = . if (CH4 >= -7 & CH4 <= -1)
replace CH5 = . if (CH5 >= -7 & CH5 <= -1)
replace CH6 = . if (CH6 >= -7 & CH6 <= -1)
replace CH7 = . if (CH7 >= -7 & CH7 <= -1)
replace CH8 = . if (CH8 >= -7 & CH8 <= -1)
replace CH9 = . if (CH9 >= -7 & CH9 <= -1)
replace CH10 = . if (CH10 >= -7 & CH10 <= -1)
replace CH12 = . if (CH12 >= -7 & CH12 <= -1)
replace CH13 = . if (CH13 >= -7 & CH13 <= -1)
replace CH14 = . if (CH14 >= -7 & CH14 <= -1)
replace CH15A = . if (CH15A >= -7 & CH15A <= -1)
replace CH15B = . if (CH15B >= -7 & CH15B <= -1)
replace CH1SS = . if (CH1SS >= -7 & CH1SS <= -1)
replace CH1SD = . if (CH1SD >= -7 & CH1SD <= -1)
replace CH1SP = . if (CH1SP >= -7 & CH1SP <= -1)
replace CH1S = . if (CH1S >= -7 & CH1S <= -1)
replace CH18 = . if (CH18 >= -7 & CH18 <= -1)
replace CH19 = . if (CH19 >= -7 & CH19 <= -1)
replace CH20 = . if (CH20 >= -7 & CH20 <= -1)
replace CH21 = . if (CH21 >= -7 & CH21 <= -1)
replace CH22 = . if (CH22 >= -7 & CH22 <= -1)
replace CH23 = . if (CH23 >= -7 & CH23 <= -1)
replace CH24 = . if (CH24 >= -7 & CH24 <= -1)
replace CH25 = . if (CH25 >= -7 & CH25 <= -1)
replace CH26 = . if (CH26 >= -7 & CH26 <= -1)
replace CH27 = . if (CH27 >= -7 & CH27 <= -1)
replace CH28 = . if (CH28 >= -7 & CH28 <= -1)
replace CH29 = . if (CH29 >= -7 & CH29 <= -1)
replace CH30 = . if (CH30 >= -7 & CH30 <= -1)
replace CH31 = . if (CH31 >= -7 & CH31 <= -1)
replace CH32A = . if (CH32A >= -7 & CH32A <= -1)
replace CH32B = . if (CH32B >= -7 & CH32B <= -1)
replace CH2SS = . if (CH2SS >= -7 & CH2SS <= -1)
replace CH2SD = . if (CH2SD >= -7 & CH2SD <= -1)
replace CH2SP = . if (CH2SP >= -7 & CH2SP <= -1)
replace CH2S = . if (CH2S >= -7 & CH2S <= -1)
replace MP1 = . if (MP1 >= -7 & MP1 <= -1)
replace MP2 = . if (MP2 >= -7 & MP2 <= -1)
replace MP3A = . if (MP3A >= -7 & MP3A <= -1)
replace MP3B = . if (MP3B >= -7 & MP3B <= -1)
replace MP4A = . if (MP4A >= -7 & MP4A <= -1)
replace MP4B = . if (MP4B >= -7 & MP4B <= -1)
replace MP5A = . if (MP5A >= -7 & MP5A <= -1)
replace MP5B = . if (MP5B >= -7 & MP5B <= -1)
replace MP5C = . if (MP5C >= -7 & MP5C <= -1)
replace MP5D = . if (MP5D >= -7 & MP5D <= -1)
replace MP5E = . if (MP5E >= -7 & MP5E <= -1)
replace MP5F = . if (MP5F >= -7 & MP5F <= -1)
replace MP5G = . if (MP5G >= -7 & MP5G <= -1)
replace MP5H = . if (MP5H >= -7 & MP5H <= -1)
replace MP5I = . if (MP5I >= -7 & MP5I <= -1)
replace MP5J = . if (MP5J >= -7 & MP5J <= -1)
replace MP5K = . if (MP5K >= -7 & MP5K <= -1)
replace MP5L = . if (MP5L >= -7 & MP5L <= -1)
replace MP5M = . if (MP5M >= -7 & MP5M <= -1)
replace MP5N = . if (MP5N >= -7 & MP5N <= -1)
replace MP5O = . if (MP5O >= -7 & MP5O <= -1)
replace MP5P = . if (MP5P >= -7 & MP5P <= -1)
replace MP5Q = . if (MP5Q >= -7 & MP5Q <= -1)
replace MP5R = . if (MP5R >= -7 & MP5R <= -1)
replace WA1 = . if (WA1 >= -7 & WA1 <= -1)
replace WA2 = . if (WA2 >= -7 & WA2 <= -1)
replace WA2A = . if (WA2A >= -7 & WA2A <= -1)
replace WA3 = . if (WA3 >= -7 & WA3 <= -1)
replace WA4 = . if (WA4 >= -7 & WA4 <= -1)
replace WA5 = . if (WA5 >= -7 & WA5 <= -1)
replace WA6 = . if (WA6 >= -7 & WA6 <= -1)
replace WA6A = . if (WA6A >= -7 & WA6A <= -1)
replace WA7 = . if (WA7 >= -7 & WA7 <= -1)
replace WA8 = . if (WA8 >= -7 & WA8 <= -1)
replace WA9A = . if (WA9A >= -7 & WA9A <= -1)
replace WA9B = . if (WA9B >= -7 & WA9B <= -1)
replace WA9C = . if (WA9C >= -7 & WA9C <= -1)
replace WA9D = . if (WA9D >= -7 & WA9D <= -1)
replace WA10 = . if (WA10 >= -7 & WA10 <= -1)
replace WA11A = . if (WA11A >= -7 & WA11A <= -1)
replace WA11B = . if (WA11B >= -7 & WA11B <= -1)
replace SA1 = . if (SA1 >= -7 & SA1 <= -1)
replace SA2 = . if (SA2 >= -7 & SA2 <= -1)
replace SA2A = . if (SA2A >= -7 & SA2A <= -1)
replace SA3 = . if (SA3 >= -7 & SA3 <= -1)
replace SA4 = . if (SA4 >= -7 & SA4 <= -1)
replace SA5 = . if (SA5 >= -7 & SA5 <= -1)
replace SA6 = . if (SA6 >= -7 & SA6 <= -1)
replace SA6A = . if (SA6A >= -7 & SA6A <= -1)
replace FU1 = . if (FU1 >= -7 & FU1 <= -1)
replace FU1A = . if (FU1A >= -7 & FU1A <= -1)
replace FU1B = . if (FU1B >= -7 & FU1B <= -1)
replace FU1C = . if (FU1C >= -7 & FU1C <= -1)
replace FU2 = . if (FU2 >= -7 & FU2 <= -1)
replace FU3 = . if (FU3 >= -7 & FU3 <= -1)
replace FU4 = . if (FU4 >= -7 & FU4 <= -1)
replace FU5 = . if (FU5 >= -7 & FU5 <= -1)
replace FU5A = . if (FU5A >= -7 & FU5A <= -1)
replace FU5B = . if (FU5B >= -7 & FU5B <= -1)
replace FU6 = . if (FU6 >= -7 & FU6 <= -1)
replace FU6A = . if (FU6A >= -7 & FU6A <= -1)
replace FU6B = . if (FU6B >= -7 & FU6B <= -1)
replace FU7 = . if (FU7 >= -7 & FU7 <= -1)
replace FU7A = . if (FU7A >= -7 & FU7A <= -1)
replace FU7B = . if (FU7B >= -7 & FU7B <= -1)
replace FU8 = . if (FU8 >= -7 & FU8 <= -1)
replace FU8A = . if (FU8A >= -7 & FU8A <= -1)
replace FU8B = . if (FU8B >= -7 & FU8B <= -1)
replace FU9 = . if (FU9 >= -7 & FU9 <= -1)
replace FU9A = . if (FU9A >= -7 & FU9A <= -1)
replace FU9B = . if (FU9B >= -7 & FU9B <= -1)
replace FU10 = . if (FU10 >= -7 & FU10 <= -1)
replace FU10A = . if (FU10A >= -7 & FU10A <= -1)
replace FU10B = . if (FU10B >= -7 & FU10B <= -1)
replace QC1 = . if (QC1 >= -7 & QC1 <= -1)
replace QC2 = . if (QC2 >= -7 & QC2 <= -1)
replace QC3 = . if (QC3 >= -7 & QC3 <= -1)
replace QC4 = . if (QC4 >= -7 & QC4 <= -1)
replace QC4B = . if (QC4B >= -7 & QC4B <= -1)
replace QC5 = . if (QC5 >= -7 & QC5 <= -1)
replace QC6 = . if (QC6 >= -7 & QC6 <= -1)
replace QC7 = . if (QC7 >= -7 & QC7 <= -1)
replace QC8 = . if (QC8 >= -7 & QC8 <= -1)
replace QCSTATE = . if (QCSTATE >= -7 & QCSTATE <= -1)
replace QCDIST = . if (QCDIST >= -7 & QCDIST <= -1)
replace QCPSU = . if (QCPSU >= -7 & QCPSU <= -1)
replace QCCODE = . if (QCCODE >= -7 & QCCODE <= -1)
replace O5A = . if (O5A >= -7 & O5A <= -1)
replace O6 = . if (O6 >= -7 & O6 <= -1)
replace O6A = . if (O6A >= -7 & O6A <= -1)
replace O6B = . if (O6B >= -7 & O6B <= -1)
replace O6C = . if (O6C >= -7 & O6C <= -1)
replace O7 = . if (O7 >= -7 & O7 <= -1)
replace EW3 = . if (EW3 >= -7 & EW3 <= -1)
replace EW4 = . if (EW4 >= -7 & EW4 <= -1)
replace EW5 = . if (EW5 >= -7 & EW5 <= -1)
replace EW7 = . if (EW7 >= -7 & EW7 <= -1)
replace EW8 = . if (EW8 >= -7 & EW8 <= -1)
replace EW9 = . if (EW9 >= -7 & EW9 <= -1)
replace HB1 = . if (HB1 >= -7 & HB1 <= -1)
replace HB2 = . if (HB2 >= -7 & HB2 <= -1)
replace HB5 = . if (HB5 == 8)
replace HB5 = . if (HB5 >= -7 & HB5 <= -1)
replace HB6 = . if (HB6 == 8)
replace HB6 = . if (HB6 >= -7 & HB6 <= -1)
replace AI1 = . if (AI1 >= -7 & AI1 <= -1)
replace AI1A = . if (AI1A >= -7 & AI1A <= -1)
replace AI1B = . if (AI1B >= -7 & AI1B <= -1)
replace AI1C = . if (AI1C >= -7 & AI1C <= -1)
replace AI1D = . if (AI1D >= -7 & AI1D <= -1)
replace AI1E = . if (AI1E >= -7 & AI1E <= -1)
replace AI2 = . if (AI2 >= -7 & AI2 <= -1)
replace GR1A = . if (GR1A >= -7 & GR1A <= -1)
replace GR1B = . if (GR1B >= -7 & GR1B <= -1)
replace GR1C = . if (GR1C >= -7 & GR1C <= -1)
replace GR1D = . if (GR1D >= -7 & GR1D <= -1)
replace GR1E = . if (GR1E >= -7 & GR1E <= -1)
replace GR1F = . if (GR1F >= -7 & GR1F <= -1)
replace GR1G = . if (GR1G >= -7 & GR1G <= -1)
replace GR2A = . if (GR2A >= -7 & GR2A <= -1)
replace GR2B = . if (GR2B >= -7 & GR2B <= -1)
replace GR2C = . if (GR2C >= -7 & GR2C <= -1)
replace GR2D = . if (GR2D >= -7 & GR2D <= -1)
replace GR2E = . if (GR2E >= -7 & GR2E <= -1)
replace GR2F = . if (GR2F >= -7 & GR2F <= -1)
replace GR2G = . if (GR2G >= -7 & GR2G <= -1)
replace GR3A = . if (GR3A >= -7 & GR3A <= -1)
replace GR3B = . if (GR3B >= -7 & GR3B <= -1)
replace GR3C = . if (GR3C >= -7 & GR3C <= -1)
replace GR3D = . if (GR3D >= -7 & GR3D <= -1)
replace GR3E = . if (GR3E >= -7 & GR3E <= -1)
replace GR3F = . if (GR3F >= -7 & GR3F <= -1)
replace GR3G = . if (GR3G >= -7 & GR3G <= -1)
replace GR4A = . if (GR4A >= -7 & GR4A <= -1)
replace GR4B = . if (GR4B >= -7 & GR4B <= -1)
replace GR4C = . if (GR4C >= -7 & GR4C <= -1)
replace GR4D = . if (GR4D >= -7 & GR4D <= -1)
replace GR4E = . if (GR4E >= -7 & GR4E <= -1)
replace GR4F = . if (GR4F >= -7 & GR4F <= -1)
replace GR4G = . if (GR4G >= -7 & GR4G <= -1)
replace GR5A = . if (GR5A >= -7 & GR5A <= -1)
replace GR5B = . if (GR5B >= -7 & GR5B <= -1)
replace GR5C = . if (GR5C >= -7 & GR5C <= -1)
replace GR5D = . if (GR5D >= -7 & GR5D <= -1)
replace GR5E = . if (GR5E >= -7 & GR5E <= -1)
replace GR5F = . if (GR5F >= -7 & GR5F <= -1)
replace GR5G = . if (GR5G >= -7 & GR5G <= -1)
replace GR6A = . if (GR6A >= -7 & GR6A <= -1)
replace GR6B = . if (GR6B >= -7 & GR6B <= -1)
replace GR6C = . if (GR6C >= -7 & GR6C <= -1)
replace GR6D = . if (GR6D >= -7 & GR6D <= -1)
replace GR6E = . if (GR6E >= -7 & GR6E <= -1)
replace GR6F = . if (GR6F >= -7 & GR6F <= -1)
replace GR7A = . if (GR7A >= -7 & GR7A <= -1)
replace GR7B = . if (GR7B >= -7 & GR7B <= -1)
replace GR7C = . if (GR7C >= -7 & GR7C <= -1)
replace GR7D = . if (GR7D >= -7 & GR7D <= -1)
replace GR7E = . if (GR7E >= -7 & GR7E <= -1)
replace GR7F = . if (GR7F >= -7 & GR7F <= -1)
replace GR8A = . if (GR8A >= -7 & GR8A <= -1)
replace GR8B = . if (GR8B >= -7 & GR8B <= -1)
replace GR8C = . if (GR8C >= -7 & GR8C <= -1)
replace GR8D = . if (GR8D >= -7 & GR8D <= -1)
replace GR8E = . if (GR8E >= -7 & GR8E <= -1)
replace GR8F = . if (GR8F >= -7 & GR8F <= -1)
replace GR9 = . if (GR9 >= -7 & GR9 <= -1)
replace GR10 = . if (GR10 >= -7 & GR10 <= -1)
replace GR11A = . if (GR11A >= -7 & GR11A <= -1)
replace GR11B = . if (GR11B >= -7 & GR11B <= -1)
replace GR11C = . if (GR11C >= -7 & GR11C <= -1)
replace GR11D = . if (GR11D >= -7 & GR11D <= -1)
replace GR12A = . if (GR12A >= -7 & GR12A <= -1)
replace GR12B = . if (GR12B >= -7 & GR12B <= -1)
replace GR12C = . if (GR12C >= -7 & GR12C <= -1)
replace GR12D = . if (GR12D >= -7 & GR12D <= -1)
replace GR13 = . if (GR13 >= -7 & GR13 <= -1)
replace GR14 = . if (GR14 >= -7 & GR14 <= -1)
replace GR15A = . if (GR15A >= -7 & GR15A <= -1)
replace GR15B = . if (GR15B >= -7 & GR15B <= -1)
replace GR16 = . if (GR16 == 8)
replace GR16 = . if (GR16 >= -7 & GR16 <= -1)
replace GR17 = . if (GR17 == 8)
replace GR17 = . if (GR17 >= -7 & GR17 <= -1)
replace GR18A = . if (GR18A == 8)
replace GR18A = . if (GR18A >= -7 & GR18A <= -1)
replace GR18B = . if (GR18B == 8)
replace GR18B = . if (GR18B >= -7 & GR18B <= -1)
replace GR18C = . if (GR18C == 8)
replace GR18C = . if (GR18C >= -7 & GR18C <= -1)
replace GR19 = . if (GR19 == 9)
replace GR19 = . if (GR19 >= -7 & GR19 <= -1)
replace GR20 = . if (GR20 == 9)
replace GR20 = . if (GR20 >= -7 & GR20 <= -1)
replace GR21 = . if (GR21 >= -7 & GR21 <= -1)
replace GR22 = . if (GR22 >= -7 & GR22 <= -1)
replace GR23 = . if (GR23 >= -7 & GR23 <= -1)
replace GR24 = . if (GR24 >= -7 & GR24 <= -1)
replace GR25 = . if (GR25 >= -7 & GR25 <= -1)
replace GR26 = . if (GR26 == 9)
replace GR27 = . if (GR27 == 9)
replace GR28 = . if (GR28 == 9)
replace GR29 = . if (GR29 == 9)
replace GR30 = . if (GR30 == 9)
replace GR31 = . if (GR31 == 9)
replace GRWHO = . if (GRWHO == 9)
replace MH1A = . if (MH1A >= -7 & MH1A <= -1)
replace MH2A = . if (MH2A >= -7 & MH2A <= -1)
replace MH2C = . if (MH2C >= -7 & MH2C <= -1)
replace MH2D = . if (MH2D >= -7 & MH2D <= -1)
replace MH3 = . if (MH3 >= -7 & MH3 <= -1)
replace MH4 = . if (MH4 >= -7 & MH4 <= -1)
replace MH5A = . if (MH5A >= -7 & MH5A <= -1)
replace MH5B = . if (MH5B >= -7 & MH5B <= -1)
replace MH6 = . if (MH6 >= -7 & MH6 <= -1)
replace MH7 = . if (MH7 >= -7 & MH7 <= -1)
replace MH8 = . if (MH8 >= -7 & MH8 <= -1)
replace MH10 = . if (MH10 == 9)
replace MH10 = . if (MH10 >= -7 & MH10 <= -1)
replace MH11 = . if (MH11 >= -7 & MH11 <= -1)
replace MH12 = . if (MH12 >= -7 & MH12 <= -1)
replace MH13 = . if (MH13 >= -7 & MH13 <= -1)
replace MH14 = . if (MH14 >= -7 & MH14 <= -1)
replace MH14A = . if (MH14A >= -7 & MH14A <= -1)
replace MH15A = . if (MH15A >= -7 & MH15A <= -1)
replace MH15B = . if (MH15B >= -7 & MH15B <= -1)
replace MH16 = . if (MH16 >= -7 & MH16 <= -1)
replace MH17A = . if (MH17A >= -7 & MH17A <= -1)
replace MH17B = . if (MH17B >= -7 & MH17B <= -1)
replace MH18A = . if (MH18A >= -7 & MH18A <= -1)
replace MH19A = . if (MH19A >= -7 & MH19A <= -1)
replace MH20 = . if (MH20 >= -7 & MH20 <= -1)
replace FH1 = . if (FH1 >= -7 & FH1 <= -1)
replace FH2 = . if (FH2 >= -7 & FH2 <= -1)
replace FH3 = . if (FH3 >= -7 & FH3 <= -1)
replace FH4 = . if (FH4 >= -7 & FH4 <= -1)
replace FH5A = . if (FH5A >= -7 & FH5A <= -1)
replace FH5B = . if (FH5B >= -7 & FH5B <= -1)
replace FH6 = . if (FH6 >= -7 & FH6 <= -1)
replace FH7A = . if (FH7A >= -7 & FH7A <= -1)
replace FH7B = . if (FH7B >= -7 & FH7B <= -1)
replace FH7C = . if (FH7C >= -7 & FH7C <= -1)
replace FH7D = . if (FH7D >= -7 & FH7D <= -1)
replace FHCHK = . if (FHCHK >= -7 & FHCHK <= -1)
replace FP1 = . if (FP1 >= -7 & FP1 <= -1)
replace FP2A = . if (FP2A >= -7 & FP2A <= -1)
replace FP2B = . if (FP2B >= -7 & FP2B <= -1)
replace FP2C = . if (FP2C >= -7 & FP2C <= -1)
replace FP3A = . if (FP3A >= -7 & FP3A <= -1)
replace FP3B = . if (FP3B >= -7 & FP3B <= -1)
replace FP3C = . if (FP3C >= -7 & FP3C <= -1)
replace FP4A = . if (FP4A >= -7 & FP4A <= -1)
replace FP4B = . if (FP4B >= -7 & FP4B <= -1)
replace FP4C = . if (FP4C >= -7 & FP4C <= -1)
replace FP5 = . if (FP5 >= -7 & FP5 <= -1)
replace FP5A = . if (FP5A >= -7 & FP5A <= -1)
replace FP5B = . if (FP5B >= -7 & FP5B <= -1)
replace FPWHO = . if (FPWHO >= -7 & FPWHO <= -1)
replace LB0 = . if (LB0 >= -7 & LB0 <= -1)
replace LB1A = . if (LB1A >= -7 & LB1A <= -1)
replace LB1B = . if (LB1B >= -7 & LB1B <= -1)
replace LB2A = . if (LB2A >= -7 & LB2A <= -1)
replace LB2B = . if (LB2B >= -7 & LB2B <= -1)
replace LB3A = . if (LB3A >= -7 & LB3A <= -1)
replace LB3B = . if (LB3B >= -7 & LB3B <= -1)
replace LB3C = . if (LB3C >= -7 & LB3C <= -1)
replace LB3D = . if (LB3D >= -7 & LB3D <= -1)
replace LB3E = . if (LB3E >= -7 & LB3E <= -1)
replace LB3F = . if (LB3F >= -7 & LB3F <= -1)
replace LB3G = . if (LB3G >= -7 & LB3G <= -1)
replace LB3H = . if (LB3H >= -7 & LB3H <= -1)
replace LB3I = . if (LB3I >= -7 & LB3I <= -1)
replace LB4 = . if (LB4 >= -7 & LB4 <= -1)
replace LB5 = . if (LB5 >= -7 & LB5 <= -1)
replace LB6 = . if (LB6 >= -7 & LB6 <= -1)
replace LB7A = . if (LB7A >= -7 & LB7A <= -1)
replace LB7B = . if (LB7B >= -7 & LB7B <= -1)
replace LB7C = . if (LB7C >= -7 & LB7C <= -1)
replace LB7D = . if (LB7D >= -7 & LB7D <= -1)
replace LB7E = . if (LB7E >= -7 & LB7E <= -1)
replace LB7F = . if (LB7F >= -7 & LB7F <= -1)
replace LB7G = . if (LB7G >= -7 & LB7G <= -1)
replace LB7H = . if (LB7H >= -7 & LB7H <= -1)
replace LB8 = . if (LB8 >= -7 & LB8 <= -1)
replace LB9A = . if (LB9A >= -7 & LB9A <= -1)
replace LB9B = . if (LB9B >= -7 & LB9B <= -1)
replace LB9C = . if (LB9C >= -7 & LB9C <= -1)
replace LB9D = . if (LB9D >= -7 & LB9D <= -1)
replace LB9E = . if (LB9E >= -7 & LB9E <= -1)
replace LB9F = . if (LB9F >= -7 & LB9F <= -1)
replace LB10 = . if (LB10 >= -7 & LB10 <= -1)
replace LB12 = . if (LB12 >= -7 & LB12 <= -1)
replace LB13 = . if (LB13 >= -7 & LB13 <= -1)
replace LB14 = . if (LB14 >= -7 & LB14 <= -1)
replace LB15A = . if (LB15A >= -7 & LB15A <= -1)
replace LB15B = . if (LB15B >= -7 & LB15B <= -1)
replace LB15C = . if (LB15C >= -7 & LB15C <= -1)
replace LB15D = . if (LB15D >= -7 & LB15D <= -1)
replace LB15E = . if (LB15E >= -7 & LB15E <= -1)
replace LB16 = . if (LB16 >= -7 & LB16 <= -1)
replace LB17 = . if (LB17 >= -7 & LB17 <= -1)
replace LB18 = . if (LB18 >= -7 & LB18 <= -1)
replace LB18A = . if (LB18A >= -7 & LB18A <= -1)
replace LB19A = . if (LB19A >= -7 & LB19A <= -1)
replace LB19B = . if (LB19B >= -7 & LB19B <= -1)
replace LB20 = . if (LB20 >= -7 & LB20 <= -1)
replace LB22 = . if (LB22 >= -7 & LB22 <= -1)
replace LB23 = . if (LB23 >= -7 & LB23 <= -1)
replace LB24 = . if (LB24 >= -7 & LB24 <= -1)
replace LB25 = . if (LB25 >= -7 & LB25 <= -1)
replace LB26A = . if (LB26A >= -7 & LB26A <= -1)
replace LB26B = . if (LB26B >= -7 & LB26B <= -1)
replace LB27 = . if (LB27 >= -7 & LB27 <= -1)
replace LB28 = . if (LB28 >= -7 & LB28 <= -1)
replace LB29 = . if (LB29 >= -7 & LB29 <= -1)
replace LB30 = . if (LB30 >= -7 & LB30 <= -1)
replace LB31 = . if (LB31 >= -7 & LB31 <= -1)
replace LB32 = . if (LB32 >= -7 & LB32 <= -1)
replace LB33 = . if (LB33 >= -7 & LB33 <= -1)
replace LB34A = . if (LB34A >= -7 & LB34A <= -1)
replace LB34B = . if (LB34B >= -7 & LB34B <= -1)
replace LB35 = . if (LB35 >= -7 & LB35 <= -1)
replace LB36A = . if (LB36A >= -7 & LB36A <= -1)
replace LB36A1 = . if (LB36A1 >= -7 & LB36A1 <= -1)
replace LB36B = . if (LB36B >= -7 & LB36B <= -1)
replace LB36B1 = . if (LB36B1 >= -7 & LB36B1 <= -1)
replace LB36C = . if (LB36C >= -7 & LB36C <= -1)
replace LB36C1 = . if (LB36C1 >= -7 & LB36C1 <= -1)
replace LB36D = . if (LB36D >= -7 & LB36D <= -1)
replace LB36D1 = . if (LB36D1 >= -7 & LB36D1 <= -1)
replace LB36E = . if (LB36E >= -7 & LB36E <= -1)
replace LB36E1 = . if (LB36E1 >= -7 & LB36E1 <= -1)
replace NL1A = . if (NL1A >= -7 & NL1A <= -1)
replace NL1B = . if (NL1B >= -7 & NL1B <= -1)
replace NL2A = . if (NL2A >= -7 & NL2A <= -1)
replace NL2B = . if (NL2B >= -7 & NL2B <= -1)
replace NL2C = . if (NL2C >= -7 & NL2C <= -1)
replace NL2D = . if (NL2D >= -7 & NL2D <= -1)
replace NL2E = . if (NL2E >= -7 & NL2E <= -1)
replace NL2F = . if (NL2F >= -7 & NL2F <= -1)
replace NL2G = . if (NL2G >= -7 & NL2G <= -1)
replace NL2H = . if (NL2H >= -7 & NL2H <= -1)
replace NL2I = . if (NL2I >= -7 & NL2I <= -1)
replace NL3 = . if (NL3 >= -7 & NL3 <= -1)
replace NL4 = . if (NL4 >= -7 & NL4 <= -1)
replace NL5 = . if (NL5 >= -7 & NL5 <= -1)
replace NL6A = . if (NL6A >= -7 & NL6A <= -1)
replace NL6B = . if (NL6B >= -7 & NL6B <= -1)
replace NL6C = . if (NL6C >= -7 & NL6C <= -1)
replace NL6D = . if (NL6D >= -7 & NL6D <= -1)
replace NL6E = . if (NL6E >= -7 & NL6E <= -1)
replace NL6F = . if (NL6F >= -7 & NL6F <= -1)
replace NL6G = . if (NL6G >= -7 & NL6G <= -1)
replace NL6H = . if (NL6H >= -7 & NL6H <= -1)
replace NL7 = . if (NL7 >= -7 & NL7 <= -1)
replace NL8A = . if (NL8A >= -7 & NL8A <= -1)
replace NL8B = . if (NL8B >= -7 & NL8B <= -1)
replace NL8C = . if (NL8C >= -7 & NL8C <= -1)
replace NL8D = . if (NL8D >= -7 & NL8D <= -1)
replace NL8E = . if (NL8E >= -7 & NL8E <= -1)
replace NL8F = . if (NL8F >= -7 & NL8F <= -1)
replace NL9 = . if (NL9 >= -7 & NL9 <= -1)
replace NL12 = . if (NL12 >= -7 & NL12 <= -1)
replace NL13 = . if (NL13 >= -7 & NL13 <= -1)
replace NL14 = . if (NL14 >= -7 & NL14 <= -1)
replace NL15A = . if (NL15A >= -7 & NL15A <= -1)
replace NL15B = . if (NL15B >= -7 & NL15B <= -1)
replace NL15C = . if (NL15C >= -7 & NL15C <= -1)
replace NL15D = . if (NL15D >= -7 & NL15D <= -1)
replace NL15E = . if (NL15E >= -7 & NL15E <= -1)
replace NL16 = . if (NL16 >= -7 & NL16 <= -1)
replace NL17 = . if (NL17 >= -7 & NL17 <= -1)
replace NL18 = . if (NL18 >= -7 & NL18 <= -1)
replace NL18A = . if (NL18A >= -7 & NL18A <= -1)
replace NL19A = . if (NL19A >= -7 & NL19A <= -1)
replace NL19B = . if (NL19B >= -7 & NL19B <= -1)
replace NL20 = . if (NL20 >= -7 & NL20 <= -1)
replace NL22 = . if (NL22 >= -7 & NL22 <= -1)
replace NL23 = . if (NL23 >= -7 & NL23 <= -1)
replace NL24 = . if (NL24 >= -7 & NL24 <= -1)
replace NL25 = . if (NL25 >= -7 & NL25 <= -1)
replace NL26A = . if (NL26A >= -7 & NL26A <= -1)
replace NL26B = . if (NL26B >= -7 & NL26B <= -1)
replace NL27 = . if (NL27 >= -7 & NL27 <= -1)
replace NL28 = . if (NL28 >= -7 & NL28 <= -1)
replace NL29 = . if (NL29 >= -7 & NL29 <= -1)
replace NL30 = . if (NL30 >= -7 & NL30 <= -1)
replace NL31 = . if (NL31 >= -7 & NL31 <= -1)
replace NL32 = . if (NL32 >= -7 & NL32 <= -1)
replace NL33 = . if (NL33 >= -7 & NL33 <= -1)
replace NL34A = . if (NL34A >= -7 & NL34A <= -1)
replace NL34B = . if (NL34B >= -7 & NL34B <= -1)
replace NL35 = . if (NL35 >= -7 & NL35 <= -1)
replace NL36A = . if (NL36A >= -7 & NL36A <= -1)
replace NL36A1 = . if (NL36A1 >= -7 & NL36A1 <= -1)
replace NL36B = . if (NL36B >= -7 & NL36B <= -1)
replace NL36B1 = . if (NL36B1 >= -7 & NL36B1 <= -1)
replace NL36C = . if (NL36C >= -7 & NL36C <= -1)
replace NL36C1 = . if (NL36C1 >= -7 & NL36C1 <= -1)
replace NL36D = . if (NL36D >= -7 & NL36D <= -1)
replace NL36D1 = . if (NL36D1 >= -7 & NL36D1 <= -1)
replace NL36E = . if (NL36E >= -7 & NL36E <= -1)
replace NL36E1 = . if (NL36E1 >= -7 & NL36E1 <= -1)
replace HQ1 = . if (HQ1 >= -7 & HQ1 <= -1)
replace HQ2A = . if (HQ2A >= -7 & HQ2A <= -1)
replace HQ2B = . if (HQ2B >= -7 & HQ2B <= -1)
replace HQ3 = . if (HQ3 >= -7 & HQ3 <= -1)
replace HQ4 = . if (HQ4 >= -7 & HQ4 <= -1)
replace HQ5 = . if (HQ5 >= -7 & HQ5 <= -1)
replace HQ6 = . if (HQ6 >= -7 & HQ6 <= -1)
replace OG1 = . if (OG1 >= -7 & OG1 <= -1)
replace OG2 = . if (OG2 >= -7 & OG2 <= -1)
replace OG3 = . if (OG3 >= -7 & OG3 <= -1)
replace OG4 = . if (OG4 >= -7 & OG4 <= -1)
replace OG5 = . if (OG5 >= -7 & OG5 <= -1)
replace OG6 = . if (OG6 >= -7 & OG6 <= -1)
replace OG7 = . if (OG7 >= -7 & OG7 <= -1)


*	************************************************************************
*	2. Dependent Variable(s)
*		FU1: "Does this house have electricity."
*			0 = no
*			1 = yes
*		FU1A: "How many hours per day do you generally have power."
*		FU1C: "How much did you pay for it [electricity] last month"
*	************************************************************************

*	Hours of electricity

label variable FU1A "Hours of Electricity"

label variable FU1 "Electricity"

quiet tab FU1A, gen(elechours)

*	Nonlinear hours of electricity

gen hours2 = FU1A ^2
label variable hours2 "Hours of Electricity (squared)"

*	************************************************************************
*	3. Independent Variable(s)
*		ID9: "Rural/Urban/Slum."
*			1 = rural
*			2 = urban
*			3 = urban slum
*		HI9: "Rural/Urban/Slum." (NOTE: seems identical to ID9; rho = .99)
*	************************************************************************

*	Rural vs. Urban housholds

gen rural = 0
replace rural = 1 if ID9 == 1
label variable rural "Rural"

gen urban = 0
replace urban = 1 if ID9 == 2
label variable urban "Urban"

gen urbanslum = 0
replace urbanslum = 1 if ID9 == 3
label variable urbanslum "Slum"

gen location = .
replace location = 0 if urban == 1
replace location = 1 if rural == 1
replace location = 2 if urbanslum == 1
label define loc 0 "Urban" 1 "Rural" 2 "Slum"
label values location loc
label variable location "Location"





*	************************************************************************
*	4. Control Variable(s)
*		NF6: "So, that means your household earned (amount) rupees last year. 
*			Does that sound right." 
*		ME5:"Does anybody in the household belong to a credit or savings groups"
*		HHED5ADULT: "Now, I would like to ask you some questions about the 
*			education of each member of your family." Note: highest educational
*			achievment of any household adult.
*		FM3: "Does this household own or cultivate any agricultural land."
*	************************************************************************

*	Income
label variable INCOME "Income"

gen lognetincome = log(NF6 + 1)
label variable lognetincome "Log Income"

*	Education
label variable HHED5ADULT "Education"

*	Houshold size
label variable NPERSONS "Household Size"

label variable FM3 "Agriculture"

*	Create a wealth index
* CG2: bike
* CG3: sewing
* CG5: mixer/grinder
* CG6: motor cycle
* CG10: clock/watch
* CG15: cell phone
* CG12: chair/table
* CG13: cot
* CG17: pressure cooker
* To add: chair/table, pressure cooker, cot
* OLD factor CG2 CG3 CG5 CG6 CG8 CG9 CG10 CG15 CG17, pcf

factor CG2 CG3 CG5 CG6 CG10 CG15 CG12 CG13 CG17
rotate
predict factor*
label variable factor1 "Wealth Index"

factor CG2 CG3 CG6 CG10 CG12 CG13 CG17
rotate
predict factoralt*
label variable factoralt1 "Wealth Index (alt.)"


*	Create an electricity asset index
* CG8: color tv
* CG9: air cooler
* CG16: fridge
* CH11: electric fan
* CG14: phone
* CG19: air conditioner
* CG20: washing machine

factor CG8 CG9 CG16 CG14 CG11 CG19 CG20
rotate
predict elecasset*
label variable elecasset1 "Electric Asset Ownership Index"


*	************************************************************************
*	5. Other
*	************************************************************************

*	State FE
quiet tab STATEID, gen(statefe)

*	District FE 	TOO LARGE
*quiet tab DISTNAME, gen(distfe)


*	Generate new data: is the state under the control of Congress Party
*	in the most recent election
*		Andhra Pradesh 2009 = 28
*		Arunachal Pradesh 2009 = 12
*		Assam 2011 = 18
*		Delhi 2008 = 7
*		Haryana 2009 = 6
*		[Himachal Pradesh: seems to have changed since 2007] = 2
*		[Kerala 2011] = 32
*		Maharashtra 2009 = 27
*		Manipur 2012 = 14
*		Meghalaya 2008 = 17
*		Mizoram 2008 = 15
*		Rajasthan 2008 = 8
*		Uttaranchal 2012 = 5

*gen chiefm_congress_recent = 0
*replace chiefm_congress_recent = 1 if STATEID == 


*	Generate new data: is the state under the control of Congress Party
*	before 2004 (when the Maryland data was collected)
*		Andhra Pradesh 2004 = 28
*		Arunachal Pradesh 2004 = 12
*		Assam 2001 = 18
*		Delhi 2003 = 7
*		Himachal Pradesh 2003 = 2
*		Kerala 2001 = 32
*		Maharashtra 2004 = 27
*		Manipur 2002 = 14
*		Meghalaya 2003 = 17
*		Punjab 2002 = 3
*		Pondicherry/Puducherry 2001 = 34
*		Uttaranchal 2002 = 5

gen chiefm_congress_pre2004 = 0
replace chiefm_congress_pre2004 = 1 if STATEID == 28
replace chiefm_congress_pre2004 = 1 if STATEID == 12
replace chiefm_congress_pre2004 = 1 if STATEID == 18
replace chiefm_congress_pre2004 = 1 if STATEID == 7
replace chiefm_congress_pre2004 = 1 if STATEID == 2
replace chiefm_congress_pre2004 = 1 if STATEID == 32
replace chiefm_congress_pre2004 = 1 if STATEID == 27
replace chiefm_congress_pre2004 = 1 if STATEID == 14
replace chiefm_congress_pre2004 = 1 if STATEID == 17
replace chiefm_congress_pre2004 = 1 if STATEID == 3
replace chiefm_congress_pre2004 = 1 if STATEID == 34
replace chiefm_congress_pre2004 = 1 if STATEID == 5
label variable chiefm_congress_pre2004 "Congress"


gen chiefm_x_rural = chiefm_congress_pre2004 * rural
label variable chiefm_x_rural "Congress * Rural"

gen chiefm_x_urbanslum = chiefm_congress_pre2004 * urbanslum
label variable chiefm_x_urbanslum "Congress * Urban/Slum"


*	Corruption data.
*	Source: "India Corruption Study 2005.pdf"
gen corruption = .
replace corruption = 240 if STATEID == 32
replace corruption = 301 if STATEID == 2
replace corruption = 417 if STATEID == 24
replace corruption = 421 if STATEID == 28
replace corruption = 433 if STATEID == 27
replace corruption = 445 if STATEID == 4
replace corruption = 459 if STATEID == 3
replace corruption = 461 if STATEID == 19
replace corruption = 475 if STATEID == 21
replace corruption = 491 if STATEID == 9
replace corruption = 496 if STATEID == 7
replace corruption = 509 if STATEID == 33
replace corruption = 516 if STATEID == 6
replace corruption = 520 if STATEID == 20
replace corruption = 542 if STATEID == 18
replace corruption = 543 if STATEID == 8
replace corruption = 576 if STATEID == 29
replace corruption = 584 if STATEID == 23
replace corruption = 655 if STATEID == 1
replace corruption = 695 if STATEID == 10
label variable corruption "Corruption"


*	Merging new data 
merge m:1 STATEID using "./StateData1990.dta"


*	Groupings
sum corruption, detail
gen groupcorruption = .
replace groupcorruption = 0 if corruption < `r(p25)'
replace groupcorruption = 1 if corruption >= `r(p25)' & corruption < `r(p50)'
replace groupcorruption = 2 if corruption >= `r(p50)' & corruption < `r(p75)'
replace groupcorruption = 3 if corruption >= `r(p75)'
label variable groupcorruption "Corruption"
label define gc 0 "Very Low Corruption" 1 "Low Corruption" 2 "High Corruption" 3 "Very High Corruption"
label values groupcorruption gc

sum ideology, detail
gen groupideology = .
replace groupideology = 1 if ideology < `r(p50)'
replace groupideology = 0 if ideology >= `r(p50)'
label variable groupideology "Ideology"
label define gi 1 "Right" 0 "Left"
label values groupideology gi

sum overlap, detail
gen groupoverlap = .
replace groupoverlap = 0 if overlap < `r(p50)'
replace groupoverlap = 1 if overlap >= `r(p50)'
label variable groupoverlap "Overlap with Central Government"
label define go 0 "Low Overlap" 1 "High Overlap"
label values groupoverlap go


gen metropolitan = 0
replace metropolitan = 1 if METRO6 == 1 | METRO6 == 2 | METRO6 == 3 | METRO6 == 4 | METRO6 == 5 | METRO6 == 6
label variable metropolitan "Metropolitan"
